AI Verified

Name

Hide admin notices for all users except 1

About

Hide admin notices for all users except 1, defined by user ID

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

Graffic Traffic

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Snippet Source:

codewp.ai

History

Last modified:

12/05/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Hide admin notices for all users except 1

 
                    
1// Get current user object
2$user = wp_get_current_user();
3 
4// Check if user is our specific user (change ID to desired user)
5if( $user->ID !== 123 ) {
6 // Remove all notifications for non-specific user
7 function gtcs_hide_notifications() {
8 remove_all_actions( 'admin_notices' );
9 }
10 add_action( 'admin_init', 'gtcs_hide_notifications' );
11}

0

Related Snippets

Please see some snippets below related to this snippet..

WordPress Admin

AI Verified

0

Rename Posts to News

Added: 1 year ago

Last Updated: 1 year ago

Posts is a rather general terms. Some clients like to rename this to something more specific like "News".

WordPress Admin

Unverified

0

Password Login Page Text Change

Added: 2 months ago

Last Updated: 2 months ago

WordPress Admin

AI Verified

1

Add a custom post type to WordPress named "Slides"

Added: 1 year ago

Last Updated: 9 months ago

Add a custom post type to WordPress without having to use a plugin.

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

AI Verified

1

WPML minor edit on by default

Added: 2 years ago

Last Updated: 10 months ago

Turn on the 'minor edit' option by default, so all pages and posts edits aren't pushed to translations.

WooCommerce

AI Verified

0

Sort order items by SKU

Added: 1 year ago

Last Updated: 1 year ago

Sort the ordered items in woocommerce order by the SKU (as opposed to the order in which the user added the product to the cart)

Security

AI Verified

0

Disable Wordpress comments

Added: 9 months ago

Last Updated: 9 months ago